<html>
<head>
    <title></title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
</head>
<script type="text/javascript" src="../dest/jsmart.js"></script>
<style>
    .list{
        border:1px solid #0d3349;
        border-spacing:0px;
    }
    .list td{
        border:1px solid #0d3349;
        margin:0;
        padding: 0;
    }
</style>
<body>
jSmarty用法列表(不在表中的用法，当前未实现)<br/>
数据源:
{<br/>
a: 'Tue Mar 25 2014 13:32:00 GMT+0800 (CST)',<br/>
b: 50,<br/>
search: 'good',<br/>
html:'&lt;div id="case8_display"&gt;&lt;/div&gt;',<br/>
javascript:'for (var i = 0; i <= 8; i++) {}',<br/>
searchInfo:{keyWord:1,s:{a:1}},<br/>
classList: [<br/>
{id: 1, name: 'test1'},<br/>
{id: 2, name: 'test2222222222222'},<br/>
{id: 3, name: 'test3'}<br/>
]<br/>
};
<table  class="list">
    <tr>
        <td>
            <div id="case0">
                {$e|default:"default value"}<br/>
                {$searchInfo.keyWord}<br/>
                {$searchInfo.s.a|escape:"javascript"}<br/>
                {$b/($a - $b)/2}<br/>
                {"asdfasdfwww"|nl2br}<br/>
                {124.62|string_format:"%.1f"}<br/>
                {$html|escape:"html"}<br/>
                {"http://www.sohu.com?a=1&b=2"|escape:"url"}<br/>
                {$javascript|escape:"javascript"}<br/>
                {$searchInfo.s.a|escape:"javascript"}<br/>
                {'a b'|spacify:"f"}<br/>
                {""|default:"default value"|truncate:7}<br/>
                {$a|date_format:"%Y-%m-%d"}<br/>
                {"asdfasdf"|capitalize:true}<br/>
                {12312312|fsize_format:"MB":3}<br/>
                {'lowcase'|cat:"111"}<br/>
                {'count_words'|replace:"cou":"comeon"}<br/>
                {'lowcase'|upper}<br/>
                {'low ca se'|strip:"^"}<br/>

            </div>
        </td>
        <td>
            <div id="case0_display"></div>
        </td>
    </tr>
    <tr>
        <td>
            <div id="case1">
                tempSearchData = '{$search}';
            </div>
        </td>
        <td>
            <div id="case1_display"></div>
        </td>
    </tr>
    <tr>
        <td>
            <div id="case2">
                {foreach from=$classList item="classItem"}
                    &lt;dd id="{$classItem.id}"&gt;<br/>
                &lt;a href="#">&lt;span>{$classItem["name"]}&lt;/span&gt;&lt;/a&gt;<br/>
                &lt;/dd&gt;<br/>
                {/foreach}
            </div>
        </td>
        <td>
            <div id="case2_display"></div>
        </td>
    </tr>
    <tr>
        <td>
            <div id="case3">
                {foreach from=$classList item=classItem name="foo"}<br/>
                    {$smarty.foreach.foo.index}<br/>
                    {$smarty.foreach.foo.last}<br/>
                &lt;dd id="{$classItem.id}"&gt;<br/>
                &lt;a href="#">&lt;span&gt;{$classItem.name|default:"default value"|truncate:6}&lt;/span&gt;&lt;/a&gt;<br/>
                &lt;/dd&gt;<br/>
                {/foreach}
            </div>
        </td>
        <td>
            <div id="case3_display"></div>
        </td>
    </tr>
    <tr>
        <td>
            <div id="case4">
                {literal}
                    {foreach from=$classList item=classItem name=foo}<br/>
                        {$smarty.foreach.foo.index}<br/>{$smarty.foreach.foo.last}<br/>
                &lt;dd id="{$classItem.id}"&gt;<br/>
                &lt;a href="#"&gt;&lt;span&gt;{$classItem.name}&lt;/span&gt;&lt;/a&gt;<br/>
                &lt;/dd&gt;
                    {/foreach}
                {/literal}
            </div>
        </td>
        <td>
            <div id="case4_display"></div>
        </td>
    </tr>
    <tr>
        <td>
            <div id="case5">
                {foreach from=$emptyList item=classItem name=foo}<br/>
                    {$smarty.foreach.foo.index}<br/>
                {$smarty.foreach.foo.last}<br/>
                &lt;dd id="{$classItem.id}"&gt;<br/>
                &lt;a href="#"&gt;&lt;span&gt;{$classItem.name}&lt;/span&gt;&lt;/a&gt;<br/>
                &lt;/dd&gt;<br/>
                {foreachelse}
                    foreach为空
                {/foreach}
            </div>
        </td>
        <td>
            <div id="case5_display"></div>
        </td>
    </tr>
    <tr>
        <td>
            <div id="case6">
                {assign var="asdf" value="test"}<br/>
                {$asdf}
            </div>
        </td>
        <td>
            <div id="case6_display"></div>
        </td>
    </tr>
    <tr>
        <td>
            <div id="case7">
                {if "asdf" eq "asdf"}<br/>
                $a<1<br/>
                {/if}<br/>
                {if $a lt 1}<br/>
                    $a<1<br/>
                {else}<br/>
                    $a>1<br/>
                {/if}

            </div>
        </td>
        <td>
            <div id="case7_display"></div>
        </td>
    </tr>
    <tr>
        <td>
            <div id="case8">
                {if $a <= 1}<br/>
                    $a<1<br/>
                {elseif $b > 10}<br/>
                    $b>10<br/>
                {else}<br/>
                    $a>1<br/>
                {/if}
            </div>
        </td>
        <td>
            <div id="case8_display"></div>
        </td>
    </tr>
    <tr>
        <td>
            <div id="case9">
                {if $searchInfo.keyWord!="" }<br/>
                asdf<br/>
                {else}<br/>
                {$searchInfo.keyWord}<br/>
                {/if}<br/>
                {if $b is even}<br/>
                tr<br/>
                {else}<br/>
                tr<br/>
                {/if}<br/>
                或的写法<br/>


                并的写法,ne 代表!= eq代表==<br/>
                {if $b>0 and $searchInfo.keyWord ne null }<br/>
                成功<br/>
                {/if}<br/>
                是不是可以被2整除的写法<br/>

            </div>
        </td>
        <td>
            <div id="case9_display"></div>
        </td>
    </tr>
    <tr>
        <td>
            <div id="case10">
                {assign var="foo" value=$a+$search|strlen}{$foo}<br/>
                {assign var="foo" value=$search|strlen}{$foo}<br/>
                {assign var=foo value="$search|strlen"}{$foo}<br/>
                {include file="a" "asdf"="1"}<br/>

            </div>
        </td>
        <td>
            <div id="case10_display"></div>
        </td>
    </tr>

</table>


<script type="text/javascript">
    function a(str) {
        return str.replace('&lt;', '<').replace('&gt;', '>');
    }
    var data = {
        a: '2014-03-25 14:13:24 GMT+0800 (CST)',
        b: 50,
        html:'<div id="case8_display"></div>',
        javascript:'for (var i = 0; i <= 8; i++) {}',
        search: 'good',
        searchInfo:{keyWord:1,s:{a:1}},
        classList: [
            {id: 1, name: 'test1'},
            {id: 2, name: 'test2222222222222'},
            {id: 3, name: 'test3'}
        ]
    };

    for (var i = 0; i <= 10; i++) {
        var s = new NC.reMarker();
        var displayObj = document.getElementById('case' + i + '_display');
        var templateObj = document.getElementById('case' + i);
        displayObj.innerHTML = (s.proc(a(templateObj.innerHTML),data));
    }


</script>
</body>
</html>	